package com.interview.javabasic.LRU;

import java.util.LinkedHashMap;
import java.util.Map;

/*
@李子宁
Happy,happy everyday!
冲鸭！
2021/2/28

*/
public class LRUjdkDemo  extends LinkedHashMap {
    int capacity;
    public LRUjdkDemo(int capacity){
        super(capacity,0.75F,false);
        this.capacity = capacity;
    }

    @Override
    protected boolean removeEldestEntry(Map.Entry eldest) {
        return super.size() > capacity;
    }

    public static void main(String[] args) {
        LRUjdkDemo lrUjdkDemo = new LRUjdkDemo(3);

    }
}
